package com.zhoubg.spring.transaction.demo4.service.impl;

import com.zhoubg.spring.transaction.demo4.dao.AccountDao;
import com.zhoubg.spring.transaction.demo4.service.AccountService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * Create by Zhoubg at 2017/10/18
 */
@Service
public class AccountServiceImpl implements AccountService {

    @Resource
    private AccountDao accountDaoImpl;

    /**
     * @param out	:转出账号
     * @param in	:转入账号
     * @param money	:转账金额
     */
    @Transactional(readOnly = false)
    public void transfer(final String out,final String in,final Double money) {
        accountDaoImpl.outMoney(out,money);
        accountDaoImpl.inMoney(in,money);
    }
}
